package edu.bbu.commonproject.desktop.gui.view.swing.login;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

import edu.bbu.commonproject.desktop.gui.view.swing.utils.Design;

/**
 * The forgot password panel.
 */
public class ForgotPasswordPanel extends JPanel
{
	/** The base image. */
	private Image baseImage;

	/** The user name label. */
	private JLabel userNameLabel;
	
	/** The user name text field. */
	private JTextField userNameTextField;

	/** The new password user button. */
	private JButton newPasswordUserButton;
	
	/** The error label. */
	private JLabel errorLabel;
	
	/**
	 * The constructor.
	 */
	public ForgotPasswordPanel()
	{
		baseImage = Design.COMPONENT_FORGOTPASSWORD;
		
		this.setSize(new Dimension(600, 400));
		this.setLayout(null);
		
		setComponents();
	}
	
	/**
	 * Sets up the components and adds it to the panels.
	 */
	private void setComponents()
	{
		userNameLabel = new JLabel("Email adress");
		userNameLabel.setSize(new Dimension(110,30));
		userNameLabel.setLocation(110, 141);
		userNameLabel.setForeground(Color.WHITE);
		userNameLabel.setFont(new Font("SansSerif", Font.BOLD, 12));
		
		userNameTextField = new JTextField();
		userNameTextField.setSize(new Dimension(280,30));
		userNameTextField.setLocation(215, 141);
		
		newPasswordUserButton = new JButton("Send password");
		newPasswordUserButton.setSize(new Dimension(145,40));
		newPasswordUserButton.setLocation(350, 190);
		
		errorLabel = new JLabel("Inexistet e-mail adress.");
		errorLabel.setSize(new Dimension(200,40));
		errorLabel.setLocation(295, 265);
		errorLabel.setHorizontalAlignment(SwingConstants.RIGHT);
		errorLabel.setForeground(Color.ORANGE);
		errorLabel.setFont(new Font("SansSerif", Font.BOLD, 12));
		errorLabel.setVisible(false);
		
		this.add(userNameLabel);
		this.add(userNameTextField);
		this.add(newPasswordUserButton);
		this.add(errorLabel);
	}
	
	/**
	 * Gets the user name text field.
	 * @return the user name text filed.
	 */
	public JTextField getUserNameTextField()
	{
		return userNameTextField;
	}

	/**
	 * Gets the forgoton password button.
	 * @return the forgoton password button.
	 */
	public JButton getForgotPasswordButton()
	{
		return newPasswordUserButton;
	}
	
	/**
	 * Gets the error label.
	 * @return the error label.
	 */
	public JLabel getErrorLabel()
	{
		return errorLabel;
	}
	
	/**
	 * The overrided paintComponent.
	 */
	protected void paintComponent(Graphics g)
	{
		g.drawImage(baseImage, 0, 0, null);
	}
}
